package com.example.bbgds.test;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * Created by bbgds on 2016/3/1.
 */
public class HistoryView extends ExpandView {
    private RecyclerView mRecyclerView;

    public HistoryView(Context context) {
        this(context, null);
    }

    public HistoryView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public HistoryView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setBackgroundColor(0xFFEE9A00);
        View.inflate(context, R.layout.layout3, this);
        this.setHorizontalReverseExit(true);
        mRecyclerView = (RecyclerView) findViewById(R.id.listview);
        mRecyclerView.setHasFixedSize(true);
        mRecyclerView.setLayoutManager(new View3.MyLinearLayoutManager(context));
        mRecyclerView.setAdapter(new PersonAdapter());
    }

    public class PersonAdapter extends RecyclerView.Adapter<PersonViewHolder> {

        @Override
        public PersonViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            TextView view = new TextView(parent.getContext());
            view.setText("这是历史页面");
            view.setPadding(40, 40, 40, 40);
            return new PersonViewHolder(view);
        }

        @Override
        public void onBindViewHolder(PersonViewHolder holder, int position) {

        }

        @Override
        public int getItemCount() {
            return 20;
        }
    }


    private class PersonViewHolder extends RecyclerView.ViewHolder{

        public PersonViewHolder(View itemView) {
            super(itemView);
        }
    }
}
